import { IFormatterUtils } from '@/utils/interface/IFormatterUtils';

class FormatterUtils implements IFormatterUtils {
  constructor() {}

  public digitalSegmentation(
    num: number,
    digit: number,
    subStr: string
  ): string {
    const reg = new RegExp(`(?=\\B(\\d{${digit}})+$)`, 'g');
    return num.toString().replace(reg, subStr);
  }
}

const formatterUtils = new FormatterUtils();
export default formatterUtils;
